{extend name="base" /}
{block name="content"}
<div class="g-main">
    <div class="m-main-title">
        <div class="m-container-fluid">
            <a href="{:url('index/welcome')}"><i class="icon icon-home"></i>首页</a>
            <span class="icon-angle-right"></span>
            <span>系统</span>
            <span class="icon-angle-right"></span>
            <span>字段</span>
            <span class="icon-angle-right"></span>
            <span>{$info ? '编辑' : '添加'}字段</span>
            <a class="u-flush"><i class="icon-repeat"></i></a>
        </div>
    </div>
    <div class="m-main-content">
        <div class="m-container">
            <div class="m-form">
                <form class="layui-form" id="j_form">
                    <table class="m-table">
                        <thead>
                            <tr>
                                <th colspan="2">{$info ? '编辑' : '添加'}字段</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td width="15%"><label for="f">字段标识<em>*</em></label></td>
                                <td><input type="text" class="u-ipt u-ipt-long" name="f" id="f" placeholder="请输入字段标识" value="{$info.f}" /><span>由数字、字母与下划线组成，且只能以字母开头。如："title"</span></td>
                            </tr>
                            <tr>
                                <td><label for="fname">字段名称<em>*</em></label></td>
                                <td><input type="text" class="u-ipt u-ipt-long" name="fname" id="fname" placeholder="请输入字段名称" value="{$info.fname}" /></td>
                            </tr>
                            <tr>
                                <td><label for="">字段类型</label></td>
                                <td>
                                    <div class="lay-select">
                                        <select name="ftype">
                                            {foreach name="$ftype['ftype']" key="key" item="v"}
                                            <option value="{$key}"{if condition="$info['ftype'] eq $key"} selected{/if}>{$v.name}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                    <div class="m-length fl">
                                        <label for="flen">字段长度</label><input type="text" class="u-ipt u-ipt-small" name="flen" id="flen" placeholder="请输入字段长度" value="{$info.flen}" />
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td><label for="">输入表单显示元素</label></td>
                                <td>
                                    <div class="lay-select">
                                        <select name="fform">
                                            {foreach name="$ftype['fform']" key="key" item="v"}
                                            <option value="{$key}"{if condition="$info['fform'] eq $key"} selected{/if}>{$v}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td><label for="fvalue">初始值</label><br/><font color="#999">（多个值用"回车"格开；“下拉/单选/复选”格式用：值==名称；当值等于名称时，名称可省略；默认选项后加:default）</font></td>
                                <td><div class="m-textarea"><textarea name="fvalue" class="u-tarea" id="fvalue" placeholder="请输入初始值">{$info.fvalue}</textarea></div></td>
                            </tr>
                            <tr>
                                <td><label for="list_order">排序</label></td>
                                <td><input type="text" class="u-ipt u-ipt-tiny" name="list_order" id="list_order" placeholder="请输入排序值" value="{$info.list_order ?: 0}" /><span>值越大越排在前面</span></td>
                            </tr>
                            <tr>
                                <td><label for="ftext">注释</label></td>
                                <td><div class="m-textarea"><textarea name="ftext" class="u-tarea" id="ftext" placeholder="请输入注释">{$info.ftext}</textarea></div></td>
                            </tr>
                        </tbody>
                    </table>
                    <div class="m-form-btn"><input type="hidden" name="tbname" value="{$tbname}" /><input type="hidden" name="id" value="{$info.id}" /><button id="j_btn" class="u-btn">确定提交</button></div>
                </form>
            </div>
        </div>
    </div>
</div>
<input type="hidden" name="redirect_uri" value="{:url('index', ['tbname' => $tbname])}" />
{/block}
{block name="extrajs"}
{include file="public:upload"/}
{/block}